package com.qf.service;

import com.qf.dao.UserDao;
import com.qf.pojo.User;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.List;

/**
 * @author fy
 * @version V1.0
 * @Project day41
 * @Package com.qf.service
 * @Description:
 * @Date 2022/6/2 9:32
 */
public class UserServiceImpl1 implements UserService {
    private UserDao userDao;

    @PostConstruct
    public void init(){
        System.out.println("======UserServiceImpl1初始化=======");
    }

    @PreDestroy
    public void destory(){
        System.out.println("======UserServiceImpl1销毁================");
    }
    public UserServiceImpl1() {
        System.out.println("========UserServiceImpl1执行构造方法============");
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        System.out.println("========UserServiceImpl1执行set注入==========");
        this.userDao = userDao;
    }

    public void registeUser() {

        userDao.insertUser();
        System.out.println("======UserService第一个实现类=====");
    }

    public List<User> findUserAll() {
        System.out.println("==============UserServiceImpl1执行了findUserAll方法=================");
        return new ArrayList<User>();
    }

    public void insertUser(User user) {
        System.out.println("==============UserServiceImpl1执行了insertUser方法=================");
    }

    public void updateUser(User user) {
        System.out.println("==============UserServiceImpl1执行了updateUser方法=================");

    }

    public void deleteUser(Integer id) {
        System.out.println("==============UserServiceImpl1执行了deleteUser方法=================");
        int i = 1/0;

    }

}
